package com.udf.hive.udf;

import com.udf.hive.unit.StringUtils;
import org.apache.hadoop.hive.ql.exec.UDF;

public class IdNum2Province extends UDF {

    private static IdNum2Address idNum2Address = new IdNum2Address();

    public String evaluate(String input) {
        String addrStr = idNum2Address.evaluate(input);
        return StringUtils.parseProvince(addrStr);
    }

    public static void main(String[] args) {
        IdNum2Province idNum2Province = new IdNum2Province();
        System.out.println(idNum2Province.evaluate("411424198905256630"));
        System.out.println(idNum2Province.evaluate("上海市浦东新区"));
        System.out.println(idNum2Province.evaluate("上海市"));
    }
}
